"""celery入口文件"""
import sys

from celery import Celery
# 为celery使用django配置文件进行设置
import os
sys.path.append("taintain_shop/apps")
sys.path.append("taintain_shop/utils")
if not os.getenv('DJANGO_SETTINGS_MODULE'):
    os.environ['DJANGO_SETTINGS_MODULE'] = 'taintain_shop.settings.dev'


# 创建celery实例
celery_name = 'tiantian_shop'
celery_app = Celery(celery_name)  # 生产者
# 加载配置
celery_app.config_from_object('celery_tasks.config')
# 注册任务
celery_app.autodiscover_tasks(['celery_tasks.sms', 'celery_tasks.email'])
